Plots

Row

Number of Penguins

344

Average Body Mass

Column

Scatterplot of Bill Length vs Bill Depth by Species


Chart B

Chart C

Data

---
title: "Advanced Dashboarding"
output: 
  flexdashboard::flex_dashboard:
    orientation: row  #normally this is columns
    vertical_layout: fill
    #fill will resize all the panels to fit on one visible screen, if you have a lot of panels and they would get too small you can change the layout to scroll
    social: ["menu"]
    source_code: embed #you can also tell it to go to a gitHub
    theme:
      version: 4
      bootswatch: sandstone  #go to bootswatch.com 
    #try also to include a standard line about what verson of R this works with, as you update R things might need updating, check frequently 
    
---

```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(palmerpenguins)
library(plotly)
library(DT)
library(fontawesome)
data("penguins") #you will notice it says promise
#start typing the word penguins and the data populates - weird! 
```

Plots {data-navmenu="Pages"}
========================================================================

Sidebar {.sidebar}
------------------------------------------------------------------------

### Penguin Stats 

The number of penguins in the data is `r nrow(penguins)`

Row
-----------------------------------------------------------------------

### Number of Penguins

```{r}
valueBox(nrow(penguins), icon = "fa-linux")

#fontawesome website has thousands of free icons

```

### Average Body Mass

```{r}
avg_mass = round(mean(penguins$body_mass_g, na.rm = T), 1)

gauge(avg_mass,
      min(0),
      max = max(penguins$body_mass_g, na.rm = T),
      gaugeSectors(success = c(4000, 6300),
                   warning = c(2000,39999),
                   danger = c(0,19999)))
```


 

Column {.tabset}
-----------------------------------------------------------------------

### Scatterplot of Bill Length vs Bill Depth by Species 

```{r}
a = penguins %>% ggplot(aes(x = bill_length_mm, y = bill_depth_mm, color = species)) + geom_point()
ggplotly(a)

#htmpwidgets.org to find some of these widgets and how to do them 
```

----------------------------------------------------------------------

### Chart B

```{r}
penguins %>% ggplot(aes(x = body_mass_g, y = sex, fill= sex)) +
  geom_boxplot()
```

### Chart C

```{r}
penguins %>%  ggplot(aes(x = flipper_length_mm, fill = species)) +
  geom_histogram() +
  facet_wrap(~species)
```

Data {data-navmenu="Pages"}
===============================================

```{r}
penguins %>% datatable(extensions = "Buttons",
                       options = list(dom= "Blfrtip", #B is for Buttons, and the gibberish letters are for all the different things on the page 
                                      buttons = c("copy", "csv", "pdf", "print"))) 
#datatable.net has lots of other things you can do with the data table package 
```